{{ $param := (.Get 0) }}

{{ $usergroupsData := index .Page.Site.Data .Page.Sites.First.Language.Lang }}

<!-- Load usergroups and number of them-->
{{ $usergroupsCodes := slice }}
{{ $usergroupsCodesTimes := newScratch }}

{{ $usergroupsCounter := 0 }}
{{ with $usergroupsData.usergroups.usergroups }}
  {{ range . }}
    {{ range . }}
      {{ if .countryCode }}
        {{ $usergroupsCodes = $usergroupsCodes | append .countryCode }}
      {{ end }}

      {{ $usergroupsCounter = add $usergroupsCounter 1 }}
    {{ end }}
  {{ end }}
{{ end }}

{{ $usergroupsCodes = $usergroupsCodes | uniq }}

{{ if eq $param "countries" }}
  {{ len $usergroupsCodes }}
{{ end }}

{{ if eq $param "usergroups" }}
  {{ $usergroupsCounter }}
{{ end }}

